home *** CD-ROM | disk | FTP | other *** search
/ BMUG PD-ROM A / PD-ROM A.iso / Programming / Programming Languages / Yerk / Supplement / Demo Folder / Float Demo / fDemo next >
Encoding:
Text File  |  1986-02-25  |  1.1 KB  |  37 lines  |  [TEXT/MACA]

  1. \ Floating Point Demo
  2. \  2/11/86  cdn Version 1
  3.  
  4. \ 340. 512. f/    \ Mac screen pixel ratio
  5. \ 4.625 6.875 f/  \ Mac screen physical size
  6.  
  7. 0. fValue x
  8. 0. fValue y
  9. 0. fValue Shft
  10. 2. fValue Inc
  11.  
  12. : Sines { %Rad %Amp %nCYC %Pas \ %i %theta -- } localfloat
  13. \    getRect: fWind >float 2. f/ -> y  >float  2. f/ -> x    2drop
  14.  
  15.     %Pas 1/x %nCyc f+ -> %nCyc  \ Adjust # of cycles according to passes
  16.     Shft deg2rad -> Shft    \ Convert shift angle to radians
  17.     %Rad %Amp f+            \ Compute starting radius
  18.     fDup Shft COS f* x f+ float>
  19.     swap Shft SIN f* y f+ float>
  20.     pack call MoveTo        \ Move plotter to starting position
  21.  
  22.     %Pas 360. f* Inc f+  Inc -> %i
  23.     BEGIN
  24.         %i deg2rad                      \ Convert degrees to radians
  25.         fDup Shft f+ -> %theta          \ theta = theta' + Shft
  26.         %nCyc f* COS %Amp f* %Rad f+    \ COS(theta' * #Cyc) * Amp + rad
  27.         fDup %theta COS f* x f+ float>
  28.         swap %theta SIN f* y f+ float>
  29.         pack call LineTo    \ Plot To r*COS(theta)+x , r*SIN(theta)+y
  30.         %i Inc f+ -> %i
  31.         %i fOver f>
  32.     UNTIL
  33.     fDrop
  34. ;
  35.  
  36. : test  25. 75. 12. 1. Sines ;
  37.